package Be_greedy_for_snakes;

import java.util.LinkedList;
import java.util.Random;

public class Word extends Node {//定义一个Word类来继承Node类
    private LinkedList<Node> word;
    private LinkedList<String> alphabet;//单词表
    private LinkedList<String> alphabet1;//单词表中文释义

    public Word(){
        super();          //可以不写
        initAlphabet();
        initAlphabet1();
    }

    public Word(int x,int y){
        super(x,y);          //继承有参构造
        initAlphabet();
        initAlphabet1();
    }

    public void random() {
        word = new LinkedList<>();
        for(int i=0;i<5;i++){
            Random r = new Random();
            word.add(new Node(r.nextInt(50),r.nextInt(35)));
        }
    }

    private void initAlphabet() {                  //方法
        alphabet = new LinkedList<>();              //创建集合

        alphabet.add("HELLO");
        alphabet.add("WORLD");
        alphabet.add("SNAKE");
        alphabet.add("PROJECT");

    }

    private void initAlphabet1() {                  //方法
        alphabet1 = new LinkedList<>();              //创建集合
        alphabet1.add("你好");
        alphabet1.add("世界");
        alphabet1.add("蛇");
        alphabet1.add("项目");


    }

    public LinkedList<Node> getWord() {
        return word;
    }

    public void setWord(LinkedList<Node> word) {
        this.word = word;
    }

    public LinkedList<String> getAlphabet() {
        return alphabet;
    }

    public void setAlphabet(LinkedList<String> alphabet) {
        this.alphabet = alphabet;
    }

    public LinkedList<String> getAlphabet1() {
        return alphabet1;
    }

    public void setAlphabet1(LinkedList<String> alphabet1) {
        this.alphabet1 = alphabet1;
    }
}
